<?php
	include 'inc/conn.php';

	header ("Content-type:application/vnd.ms-excel");
	header ("Content-Disposition:filename=Open_Issue.xls");
	echo "<table border='1'>";
	echo "<tr><td align='center' colspan='11'>Open Issue List</td></tr>";
	echo "<tr>";
	echo " <td align='center'>编号</td>"; 
	echo " <td align='center'>问题描述</td>"; 
	echo " <td align='center'>短期对策</td>";
	echo " <td align='center'>长期对策</td>";
	echo " <td align='center'>不良状况</td>";
	echo " <td align='center'>分析人员</td>"; 
	echo " <td align='center'>责任单位</td>"; 
	echo " <td align='center'>问题状态</td>";
	echo " <td align='center'>分析内容</td>";
	echo " <td align='center'>开始时间</td>";
	echo " <td align='center'>更新时间</td>";
	echo "</tr>";

	$db = new mysql();
	$sql = "select * from validate_issues";
	$db->query($sql);
	$num = $db->db_num_rows();
	if ($num == 0)
		echo "No data was found!";

	for($i=0; $i<$num; $i++){
		$row = $db->fetch_assoc();
		$j=$i+1;
		echo "<tr><td align='center'>$j</td><td align='left'>".
							htmlspecialchars_decode($row['val_reason'])."</td><td align='left'>".
							htmlspecialchars_decode($row['val_purpose'])."</td><td align='left'>".
							htmlspecialchars_decode($row['val_scheme'])."</td><td align='center'>".
							htmlspecialchars_decode($row['val_failrate'])."</td><td align='center'>".
							htmlspecialchars_decode($row['val_owner'])."</td><td align='center'>".
							htmlspecialchars_decode($row['val_duty'])."</td><td align='center'>".
							htmlspecialchars_decode($row['val_status'])."</td><td align='left'>".
							htmlspecialchars_decode($row['val_content'])."</td><td align='center'>".
							htmlspecialchars_decode($row['val_date'])."</td><td align='center'>".
							htmlspecialchars_decode($row['val_update'])."</td></tr>";
	}
	echo "</table>";
	$db->close();
?>